#include<unistd.h>
#include<iostream>
#include <sys/types.h>
#include <sys/wait.h>
#include<stdlib.h>


int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        std::cout << "i am a child"<<std::endl;
        execl("/usr/bin/ls","ls","-l","-a",NULL);
        std::cout << "end"<<std::endl;
        exit(0);
    }
    else
    {
        pid_t rid = waitpid(-1,NULL,0);
        std::cout << "i am a father"<<std::endl;
    }
}
